// 生成随机的四位数字
function getRandomNum(min = 1000, max = 9000) {
    return Math.floor(Math.random() * (max - min) + min)
}

class Result {
    constructor(code, data, message) {
        this.data = data
        this.message = message
        this.code = code
    }

    // 三个静态类
    static success(data, message) {
        return new Result(200, data, message)
    }

    static error(code = 0, data, message) {
        return new Result(code, null, message)
    }
}

module.exports = {
    getRandomNum,
    Result
}
